package com.hmy.infrastructure.controller;

import com.hmy.ccp.common.result.FeignResult;
import com.hmy.ccp.common.result.JsonResult;
import com.hmy.ccp.common.result.Results;
import com.hmy.ccp.error.annotations.HmyFeignController;
import com.hmy.ccp.error.annotations.HmyGateWayController;
import com.hmy.infrastructure.bo.request.map.DistrictCityQueryRequest;
import com.hmy.infrastructure.bo.request.map.DistrictQueryRequest;
import com.hmy.infrastructure.bo.request.map.TruckRoutePlanRequest;
import com.hmy.infrastructure.bo.response.map.DistrictCityResponse;
import com.hmy.infrastructure.bo.response.map.DistrictQueryResponse;
import com.hmy.infrastructure.bo.response.map.TruckRoutePlanResponse;
import com.hmy.infrastructure.service.map.IMapService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 高德地图
 * @author seven.qi 齐胜南
 * @version 1.0
 * @description 高德地图
 * @date 2023/12/20 16:25
 */

@Slf4j
@Validated
@HmyGateWayController
@RestController
@RequestMapping("/api/map")
public class MapController {

    @Resource
    private IMapService mapService;

    /**
     * 高德地图-行政区域查询
     *
     * @param request 请求参数
     * @return 返回行政区域结果
     */
    @PostMapping("/feign/map/districtQuery")
    public JsonResult<DistrictQueryResponse> districtQuery(@RequestBody DistrictQueryRequest request) {
        return JsonResult.success(mapService.districtQuery(request));
    }

    /**
     * 高德地图-所有城市区域查询
     *
     * @param request 请求参数
     * @return 返回所有城市信息
     */
    @PostMapping("/feign/map/allDistrictCity")
    public JsonResult<DistrictCityResponse> allDistrictCity(@RequestBody DistrictCityQueryRequest request) {
        return JsonResult.success(mapService.allDistrictCity(request));
    }

    /**
     * 高德地图-货车路径规划基础版
     *
     * @param request 请求参数
     * @return 返回货车路径规划结果
     */
    @PostMapping("/feign/map/truckRoutePlan")
    public JsonResult<TruckRoutePlanResponse> truckRoutePlan(@RequestBody TruckRoutePlanRequest request) {
        return JsonResult.success(mapService.truckRoutePlan(request));
    }


}
